package cn.mes.module.mes.dal.mysql.basecustomerinfo;

import java.util.*;

import cn.mes.framework.common.pojo.PageResult;
import cn.mes.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.mes.framework.mybatis.core.mapper.BaseMapperX;

import cn.mes.module.mes.dal.dataobject.basecustomerinfo.BaseCustomerInfoDO;
import org.apache.ibatis.annotations.Mapper;
import cn.mes.module.mes.controller.admin.basecustomerinfo.vo.BaseCustomerInfoPageReqVO;

/**
 * 客户基础信息 Mapper
 *
 * @author 游创
 */
@Mapper
public interface BaseCustomerInfoMapper extends BaseMapperX<BaseCustomerInfoDO> {

    default PageResult<BaseCustomerInfoDO> selectPage(BaseCustomerInfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BaseCustomerInfoDO>()
                .likeIfPresent(BaseCustomerInfoDO::getCustomerName, reqVO.getCustomerName())
                .eqIfPresent(BaseCustomerInfoDO::getCustomerRemark, reqVO.getCustomerRemark())
                .eqIfPresent(BaseCustomerInfoDO::getCustomerCode, reqVO.getCustomerCode())
                .eqIfPresent(BaseCustomerInfoDO::getOrderNo, reqVO.getOrderNo())
                .betweenIfPresent(BaseCustomerInfoDO::getCreateTime, reqVO.getCreateTime())
                .orderByAsc(BaseCustomerInfoDO::getCustomerCode));
    }

}